import 'package:flutter/material.dart';
import 'package:flutter_base/config/app_color.dart';
import 'package:flutter_base/generated/assets.dart';
import 'package:flutter_base/pages/test_detail/model/model_test_detail.dart';
import 'package:flutter_base/pages/test_detail/widgets/test_card_base.dart';
import 'package:flutter_base/widgets/image/auto_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class TestKeywordTagBlock extends StatelessWidget {
  final ModelTestDetail? testDetail;
  
  const TestKeywordTagBlock({Key? key, this.testDetail}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return TestCardBase(
      child: Column(
        children: [
          // 标题
          Text(
            _getTitle(),
            textAlign: TextAlign.center,
            style: TextStyle(
              fontSize: 16.sp,
              fontWeight: FontWeight.w600,
              color: AppColor.color0C0A09,
            ),
          ),
          SizedBox(height: 12.w),
          
          // 第一行特质卡片 - 创新思维和领导力
          Row(
            children: [
              Expanded(
                child: _buildCharacteristicCard(
                  icon: Assets.innovativeThinking,
                  title: 'Innovative thinking',
                  description: 'Your innovative thinking',
                ),
              ),
              SizedBox(width: 11.w),
              Expanded(
                child: _buildCharacteristicCard(
                  icon: Assets.leadership,
                  title: 'Leadership',
                  description: 'You excel in leadership',
                ),
              ),
            ],
          ),
          
          SizedBox(height: 12.w),
          
          // 第二行特质卡片 - 团队建设者
          _buildTeamBuilderCard(),
        ],
      ),
    );
  }

  // 获取标题
  String _getTitle() {
    // 固定显示特征标签标题
    return 'What is your characteristic label?';
  }

  // 特质卡片组件
  Widget _buildCharacteristicCard({
    required String icon, 
    required String title, 
    required String description
  }) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(12.w),
        boxShadow: [
          BoxShadow(
            color: Color(0xFF646F70).withOpacity(0.1),
            blurRadius: 33.w,
            offset: Offset(0, 8.w),
          ),
        ],
      ),
      padding: EdgeInsets.all(12.w),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          // 图标
          Container(
            width: 48.w,
            height: 48.w,
            decoration: BoxDecoration(
              color: Color(0xFFFAFAF9),
              borderRadius: BorderRadius.circular(12.w),
            ),
            child: Center(
              child: AutoImage(
                icon,
                width: 32.w,
                height: 32.w,
              ),
            ),
          ),
          SizedBox(height: 8.w),
          
          // 标题
          Text(
            title,
            style: TextStyle(
              fontSize: 14.sp,
              fontWeight: FontWeight.w600,
              color: AppColor.color0C0A09,
              letterSpacing: 0.14,
            ),
          ),
          SizedBox(height: 4.w),
          
          // 描述
          Text(
            description,
            style: TextStyle(
              fontSize: 12.sp,
              color: Color(0xFF7F909F),
            ),
          ),
        ],
      ),
    );
  }

  // 团队建设者卡片组件
  Widget _buildTeamBuilderCard() {
    return Container(
      width: double.infinity,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(12.w),
        boxShadow: [
          BoxShadow(
            color: Color(0xFF646F70).withOpacity(0.1),
            blurRadius: 33.w,
            offset: Offset(0, 8.w),
          ),
        ],
      ),
      padding: EdgeInsets.all(12.w),
      child: Row(
        children: [
          // 图标
          Container(
            width: 48.w,
            height: 48.w,
            decoration: BoxDecoration(
              color: Color(0xFFFAFAF9),
              borderRadius: BorderRadius.circular(12.w),
            ),
            child: Center(
              child: AutoImage(
                Assets.teamBuilder,
                width: 32.w,
                height: 34.w,  // 略微调整高度以符合设计图
              ),
            ),
          ),
          SizedBox(width: 8.w),
          
          // 文本内容
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  'Team Builder',
                  style: TextStyle(
                    fontSize: 14.sp,
                    fontWeight: FontWeight.w600,
                    color: AppColor.color0C0A09,
                    letterSpacing: 0.14,
                  ),
                ),
                SizedBox(height: 4.w),
                Text(
                  'You are a great team builder',
                  style: TextStyle(
                    fontSize: 12.sp,
                    color: Color(0xFF7F909F),
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
} 